package com.download.backstage.controller;

import com.download.web.entity.BusArticleDownload;
import com.download.web.entity.model.Page;
import com.download.web.service.IBusArticleDownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 文章下载管理
 * @author: cmy
 * @create: 2019-03-05 12:24
 **/
@RestController
@RequestMapping("/backstage/appDownload")
public class ArticleAppDownloadController {

    @Autowired
    private IBusArticleDownloadService downloadService;

    @RequestMapping("/downloadPage")
    public Page<BusArticleDownload> downloadPage(Integer artId,Integer pageIndex,Integer pageSize){
        return downloadService.downloadListPage(artId,pageIndex,pageSize);
    }
    @RequestMapping("/addDownload")
    public String addDownload(@RequestBody BusArticleDownload articleDownload){
        return downloadService.addArticleDownload(articleDownload);
    }
    @RequestMapping("/delDownloadById")
    public void delDownloadById(Integer id){
        downloadService.removeById(id);
    }

    @RequestMapping("/updateDownload")
    public void updateDownload(@RequestBody BusArticleDownload articleDownload){
        downloadService.updateById(articleDownload);
    }

    @RequestMapping("/findById")
    public BusArticleDownload findById(Integer id){
        return downloadService.getById(id);
    }



}
